1. Technical Field
The present invention relates to databases in general, and in particular to relational databases. Still more particularly, the present invention relates to a method and apparatus for generating a transaction-bound sequence of records in a database table within a relational database.
2. Description of Related Art
Database tables are commonly utilized by database programmers during database development. A database programmer can add a numerical field, such as an ORDER field, to a database table for tracking the order in which records are entered into the database table. For example, an ORDER field can be added to an EMPLOYEE database table having a NAME field, an EMPLOYEE_NUMBER field, and a STATE field for keeping track of the order of records being inserted in the EMPLOYEE database table. Records added into the EMPLOYEE database table are typically managed by a global mechanism of a relational database. Each time a new record is added to the EMPLOYEE database table, a number is generated in the ORDER field by the global mechanism of the relational database. The value of the number in a corresponding entry of the ORDER field is automatically incremented by 1 for each new record entered, thus allowing all records in the EMPLOYEE database table to be tracked, as shown in Table I.
TABLE INAMEEMPLOYEE_NUMBERSTATEORDERname_100001TX1name_200002TX2name_300003TX3name_400004CA4name_500005CA5name_600006NY6name_700007NY7name_800008FL8name_900009FL9
Quite often, multiple records within a database table may be related or belong to a common transaction. However, global mechanisms of existing relational databases do not support numbering of the records within a database table in a transaction-bound order such that records are numbered based upon common transactions.
Consequently, it would be desirable to provide a method and system for generating a transaction-bound sequence of records in a database table within a relational database.